Skip to content

TOW 967 fix run errors responses#109

Merged
socksy merged 15 commits intofeature/tow-965-make-mcp-server-do-what-it-says-it-doesfrom
feature/tow-967-fix-run-errors-responses
Sep 29, 2025
Merged

TOW 967 fix run errors responses#109
socksy merged 15 commits intofeature/tow-965-make-mcp-server-do-what-it-says-it-doesfrom
feature/tow-967-fix-run-errors-responses

Conversation

@socksy
Copy link
Contributor

@socksy socksy commented Sep 27, 2025

Beware the number! This goes after TOW-965, but before TOW-966 in the stack of PRs!

This is whole bunch of stuff I realized had been fixed in #103 but I somehow missed taking out. And didn't notice until the tests failed to pass. But the upside is I think this PR now has some improvements over #103 even — e.g. monitor_run_completion used to .unwrap() wait_for_run_completion()... but if that returns Err() then woe betide the user who got to see a panic error message. Now that's slightly nicer I guess. But literally everything else is the same.

So...

  • parse errors correctly (tests complaining they get generic errors, and generic errors suck)
  • streamed output should be returned from runs
  • streamed output should be returned from runs even when they error (the text in the stream after an error is important!)
  • simplify some stuff that was complected with the original mcp_server() implementation, like splitting do_follow_run into do_follow_run and do_follow_run_impl — now unnecessary again
  • wait for (well, join on) both monitor_status and monitor_output (like how it is in the main branch)
  • monitor_status returns a status which we can now check
  • cute little struct return value for setup_streaming_output because its tuple was getting a bit unwieldy after I was about to add some more stuff to it

Trying to make those tests go green. We had
- api errors being printed out to the user rather than the actual
result. So we gotta look for those exact errors and return the right
thing
- wait for both output and status to complete
- if status task detects a crash, let's Err(Status::Crashed) ourselves
- let runs bubble up errors from following runs (`.await?`)
- get rid of now pointless do_follow_run_impl vs do_follow_run split -
the side effectful writing is no longer a trouble for the mcp server
- end spinner on run successs
- Error messages need to be matched against (fn extract_api_error_message)
- Stream run output correctly - needed because those messages are
matched by the CLI and integration tests
- Return log streams when runs error out, as well as when the succeed
- fix a working_dir spot, in tower_deploy (I swear I did this one already)
- add cute wee struct for streaming output instead of a tuple
@socksy socksy force-pushed the feature/tow-967-fix-run-errors-responses branch from e5669f1 to c89a1a4 Compare September 27, 2025 04:38
- Fix the validation error tests' expectation of being deployed or not
- check for "nonexistent_param" and return proper error model for
undeployed and invalid params errors (cli is not matching http statuses!)
hmm this mock server is getting pretty featureful, when can it replace prod?
The mock server is stateful and with multiple tests running either after
another (was getting issues with hello world being deployed when it
shouldn't have been), and also with parallel workers, I think it's
better we scope each test with their own unique hello_world app name.
`test_app` remains non-unique - it needs to be expected to be there (I
guess I could put it in the context, but it doesn't need to be yet so
🤷).

Other alternative was resetting the mock DB but I figured that might
lead to race conditions and it was better if this stuff was just as
idempotent as possible
Copy link
Contributor

@bradhe bradhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

- make sure we can access the app names across steps in a scenario
- move to @step everywhere so we can use @when or @then without it
  complaining
- make sure we deploy apps that are supposed to exist in advance
- hardcode in the predeployed app, to really communicate that this app
  is a special case (maybe can be replaced with actual deploying later)
…-and-improve-integration-test

TOW 966 add CLI regression tests and improve integration test
@socksy socksy merged commit e4a557b into feature/tow-965-make-mcp-server-do-what-it-says-it-does Sep 29, 2025
5 checks passed
@socksy socksy deleted the feature/tow-967-fix-run-errors-responses branch September 29, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants